hacknetfandomcom-20200222-history
Forum:Modding Hacknet - Part 3 - Files
Disclaimer DISCLAIMER: THERE IS NO OFFICIAL WAY TO MOD HACKNET AS OF NOW. THE MODDING YOU WILL BE DOING INVOLVES GOING INTO THE GAME'S FILES AND CHANGING THEM TO CREATE A MOD. PLEASE BACK-UP YOUR GAME IF YOU HAVE NOT DONE SO.\ What we're going to be doing Forum:Modding Hacknet - Part 2 - Adding Security Last time we added security for our custom computer. And last time, I said that part 3 would be about adding files, eosDevices, and linking computers. So, let's get into that. Our code last time Last time, our code at the end looked something like this: 80, 22, 21, 1433 If you don't know what all this code means, then I recommend going to the first tutorial here. Now, the computer seems very lonely. Which is why we're going to add a second computer to connect with. Adding a Second Computer We'll just create another XML file, this time, titled "SecondComputer.xml" inside the same folder. It will have some simple code: 80, 22, 21, 1433 And we have our second computer. Now it's time to add it into BootList.txt: #MyOwnComputer Content/My Own Computer/MyVeryFirstComputer.xml #Now we add this xml file: Content/My Own Computer/SecondComputer.xml Now, we have a second computer. Let's go back and link it up in the first computer. Linking the Computers We're going to use the dlink tag. What does this do? dlink is for linking two computers together, but only one way. There's no two way tag, so if you want computers to discover each other, you'll have to use two dlink tags, one on each computer. In this case, I want the player to only be able to discover the second computer (SecondComputer.xml) by scanning from the first computer (MyVeryFirstComputer.xml), but I don't want the first computer to be discoverable by having the player scan the second computer. So I will use the dlink tag in the first computer, right under the addWebServer tag of MyVeryFirstComputer.xml (Be sure not to put it into SecondComputer.xml): Wait, what was that "comp" attribute? Well, if you'll look at every single computer's code in hacknet, they all have, under the Computer tag, an "id" attribute. This attribute allows the computers to find each other. So when hacknet loads the computers, it will connect them together by their id. Now, try to see if scanning the first computer works! Adding Files So, let's add a file to our second computer. We do this with the tag: I MADE A FILE! 80, 22, 21, 1433 So, for the file tag, first we have two attributes. First is directory, which, you guessed it, says where the directory of the file is. You have the option to put the file anywhere, you just have to name the directory. Add a '/' and you can create your own folder, as shown above. The next is the Name attribute. This just shows what your file is called. It won't actually change how your file acts in any way. Next, inside of your file tag, you can insert text, so when the player opens it, they'll get what you wrote in between the tag. However, you can't really mention the player's username directly, or make files appear encrypted. This is changed through # signs. Inside a file tag, if you include # signs, you can change the way the file appears. Here's how it works: Let's say you wanted to add some random binary code, to make the file appear to be full of gibberish, and show the player's name. In our second computer, we would add: I MADE A FILE! ' '''This is of utmost urgency, #PLAYERNAME# @ #PLAYER_IP#, you must #BINARY# ' 80, 22, 21, 1433 So, what did we do? Well, we created a file in the home directory titled "readme.md.docx". It shows: The player's name (accessed through #PLAYERNAME#), the player's IP (accessed through #PLAYER_IP#), and a random string of binary (accessed through #BINARY#). There are a whole lot more of these that change the way the file is treated in Hacknet. Here's a table: Now, we've added some files, let's add an encrypted file. Back to our second computer, where we add: I MADE A FILE! This is of utmost urgency, #PLAYERNAME# @ #PLAYER_IP#, you must #BINARY# '''#PLAYER_NAME#, how did you decrypt this? 80, 22, 21, 1433 Alright. We've got a lot of attributes in this one. Let's break them down. Extension: If you want to add an extension on top of your decrypted file, that does this. IP: I honestly can't tell what this is for. I believe this is just used for the local ip, so put 192.168.1.1 for now. Header: The header for your encrypted file to access. Pass: The password you need to access your secret file. Now, if you run decypher.exe (if you have it) with the password, and congrats! You're now reading a super secret encrypted file. (There will be more added to this tutorial later)